#ifndef TC_CODECONTEXT_HH
#define TC_CODECONTEXT_HH

/** \file CodeContext.hh 
 * Declarations for the class CodeContext.
 *
 * (C) Copyright  Semih Cemiloglu
 * All rights reserved, see COPYRIGHT file for details.
 *
 * $Id: CodeContext.hh 111 2006-06-19 03:45:40Z semihc $
 *
 *
 */

#include "Global.hh"

namespace TC {


  /**
   * A Structure which keeps a contextual information about a line
   * in the source code.
   */
  struct CodeContext
  {
    // CREATORS
    CodeContext(const char* file,  int line,
                const char* func = 0)
        : m_file(file), m_line(line), m_func(func) {}

    // Default copy ctor, dtor and copy assignment are fine.

    // MEMBERS
    const char* m_file; //!< Name of the file
    int         m_line; //!< Line number with the file
    const char* m_func; //!< Function name or id string

  private:
    // NOT ALLOWED
    CodeContext();


  }; // end class


//! Make a CodeContext object on the spot
inline CodeContext 
MakeCodeContext(const char* file, int line, const char* func = 0)
{ return CodeContext(file, line, func); }

// Stream inserter for CodeContext object is defined in
// ThreadMgr.[hh|cc] to keep this header file compact.

} // end namespace


#define TC_CODECONTEXT \
  ::TC::MakeCodeContext(__FILE__, __LINE__, TC_FUNCTION)


#endif /* Include guard */
